cmake_minimum_required (VERSION 3.20)

set(MODULE_NAME EmbeddedApp)

set(SRC_LIST
    main.cpp
    MainWindow.cpp
)

set(INCLUDE_LIST
    PythonInterpreter.h
    MainWindow.h
)

add_executable(${MODULE_NAME} ${SRC_LIST} ${INCLUDE_LIST})

# 链接 pybind11::embed 目标
target_link_libraries(${MODULE_NAME} PRIVATE 
    Qt5::Core
    Qt5::Gui
    Qt5::Widgets
    pybind11::embed
    ${Python_LIBRARIES}
)

# 设置包含目录
target_include_directories(${MODULE_NAME} PRIVATE
    ${Python_INCLUDE_DIRS}
)

# 复制 Python 脚本到构建目录
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory
        ${CMAKE_SOURCE_DIR}/python/
        $<TARGET_FILE_DIR:${MODULE_NAME}>/python/
)